package Code.Day2_20240919.com.dx.day02;

/**
 * @ClassName Test03
 * @Description 类和对象
 * @Author 12994
 * @Date 2024/9/19 16:47
 * @Version 1.0
 **/

public class Student {
    /*
    成员变量(属性)默认值:
    String->null
    double->0.0
    int->0
    boolean->false
     */
    protected int id;
    protected String name;
    protected boolean sex;
    protected int age;

    private double height;
    private double weight;

    public Student(int id, String name, boolean sex, int age) {
        this.id = id;
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    public Student() {
        this.name = "";
    }

    public String getAge() {
        return (this.name + "的年龄是: " + this.age);
    }

    /**
     * @param years 要过的生日数
     * @return String 过完生日后的信息
     */
    public String happyManyBirthday(int years) {
        for (int i = 0; i < years; i++) {
            this.shouldTuiXiu();
            this.happyBirthday();
        }
        return this.name + "生日过完了, 现在" + this.age + "岁";
    }

    private void happyBirthday() {
        this.age += 1;
        System.out.println(this.name + "过了个生日, Ta现在的年龄是: " + this.age);
    }

    private void shouldTuiXiu() {
        if (this.age >= 63) {
            System.out.println(this.name + "退休了!");
        }
    }
}

